%include "./include/include.asm"
%define ZERO nop;
%define ERRORCODE push 0;
%define PROCCODE1  call irq;
bits 32;
global _start;
section .text
_start:
call kernelmain;

hlt;

global int_entry_table
section .data
    int_entry_table:

%macro VECTOR 4
section .text
int%1code:
    %2;
    push ds;
    push es;
    push fs;
    push gs;
    pushad;
        mov al,0x20;
        out 0xa0,al;
        out 0x20,al;
    push %3;
    ;call printint;
    ;call rollup;
    %4;
    add esp,4;
    popad;
    pop gs;
    pop fs;
    pop es;
    pop ds;
    add esp,4;

    iret;
section .data
    dd int%1code
%endmacro;


VECTOR 0x00,ERRORCODE,0x00,PROCCODE1;
VECTOR 0x01,ERRORCODE,0x01,PROCCODE1;
VECTOR 0x02,ERRORCODE,0x02,PROCCODE1;
VECTOR 0x03,ERRORCODE,0x03,PROCCODE1;
VECTOR 0x04,ERRORCODE,0x04,PROCCODE1;

VECTOR 0x05,ERRORCODE,0x05,PROCCODE1;
VECTOR 0x06,ERRORCODE,0x06,PROCCODE1;
VECTOR 0x07,ERRORCODE,0x07,PROCCODE1;
VECTOR 0x08,ZERO,0x08,PROCCODE1;
VECTOR 0x09,ERRORCODE,0x09,PROCCODE1;


VECTOR 0x0a,ZERO,0x0a,PROCCODE1;
VECTOR 0x0b,ZERO,0x0b,PROCCODE1;
VECTOR 0x0c,ZERO,0x0c,PROCCODE1;
VECTOR 0x0d,ZERO,0xff,ZERO;
VECTOR 0x0e,ZERO,0x0e,PROCCODE1;

VECTOR 0x0f,ERRORCODE,0x0f,PROCCODE1;
VECTOR 0x10,ERRORCODE,0x10,PROCCODE1;
VECTOR 0x11,ZERO,0x11,PROCCODE1;
VECTOR 0x12,ERRORCODE,0x12,PROCCODE1;
VECTOR 0x13,ERRORCODE,0x13,PROCCODE1;


VECTOR 0x14,ERRORCODE,0x14,PROCCODE1;
VECTOR 0x15,ERRORCODE,0x15,PROCCODE1;
VECTOR 0x16,ERRORCODE,0x16,PROCCODE1;
VECTOR 0x17,ERRORCODE,0x17,PROCCODE1;
VECTOR 0x18,ERRORCODE,0x18,PROCCODE1;

VECTOR 0x19,ERRORCODE,0x19,PROCCODE1;
VECTOR 0x1a,ERRORCODE,0x1a,PROCCODE1;
VECTOR 0x1b,ERRORCODE,0x1b,PROCCODE1;
VECTOR 0x1c,ERRORCODE,0x1c,PROCCODE1;
VECTOR 0x1d,ERRORCODE,0x1d,PROCCODE1;


VECTOR 0x1e,ZERO,0x1e,PROCCODE1;
VECTOR 0x1f,ERRORCODE,0x1f,PROCCODE1;
VECTOR 0x20,ERRORCODE,0x20,PROCCODE1;
VECTOR 0x21,ERRORCODE,0x21,PROCCODE1;


